﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practices.JsonWebToken.Compatibility {
    public partial class Decode : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {

            
        }

        protected void Button1_Click(object sender, EventArgs e) {
            string loginName = TextBox3.Text.Trim();
            int expiresSeconds = int.Parse(TextBox2.Text.Trim());
            string secretKey = TextBox1.Text.Trim();
            var payload = new Dictionary<string, object>(){
                { "unique_name", loginName }
            };
            string token = JsonWebToken.Encode(payload, secretKey, JsonWebToken.JwtHashAlgorithm.HS256);
            TextBox5.Text = token;
        }
    }
}